<include file="public@header"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>
<link href="__TMPL__/public/assets/themes/{:cmf_get_admin_style()}/house.css" rel="stylesheet">

<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="picture_urls[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="picture_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>
<script type="text/html" id="slides-item-tpl">
    <li id="slides-image{id}">
        <input id="slides-{id}" type="hidden" name="slide_urls[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="slide_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#slides-{id}');">替换</a>
        <a href="javascript:(function(){$('#slides-image{id}').remove();})();">移除</a>
    </li>
</script>
<script type="text/html" id="files-item-tpl">
    <li id="saved-file{id}">
        <input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
        <input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{name}"
               style="width: 200px;" title="文件名称">
        <a id="file-{id}-preview" href="{preview_url}" target="_blank">下载</a>
        <a href="javascript:uploadOne('文件上传','#file-{id}','file');">替换</a>
        <a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
    </li>
</script>
</head>
<body>
<div class="wrap js-check-wrap house-add">
    <ul class="nav nav-tabs">
        <li><a href="{:url('index')}">房源管理</a></li>
        <li class="active"><a href="javascript:void(0);">添加房源</a></li>
    </ul>
    <form action="{:url('addForm')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
        <div class="row">
            <div class="col-md-9">
                <table class="table table-bordered">
                    <tr>
                        <th width="100">标题<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="post[title]" id="title" required value="" placeholder="请输入标题"/>
                        </td>
                    </tr>
                    <tr>
                        <th>关键词</th>
                        <td>
                            <input class="form-control" type="text" name="post[keywords]" id="keywords" value="" placeholder="请输入关键字">
                            <p class="help-block">多关键词之间用英文逗号隔开</p>
                        </td>
                    </tr>
                    <tr>
                        <th>展示图片</th>
                        <td>
                            <ul id="slides" class="pic-list list-unstyled form-inline"></ul>
                            <a href="javascript:uploadMultiImage('图片上传','#slides','slides-item-tpl');"
                               class="btn btn-default btn-sm">选择图片</a>
                        </td>
                    </tr>
                    <tr>
                        <th>价格</th>
                        <td>
                          <p class="display-ib">
                            <span>总售价</span>
                            <input class="input-text" type="text" name="post[price]" size="8" id="price" value="" placeholder="单位万元">
                          </p>
                          <p class="display-ib">
                            <span>每平售价</span>
                            <input class="input-text" type="text" name="post[univalent]" size="6" id="source" value="" placeholder="单位元">
                          </p>
                        </td>
                    </tr>
                    <tr>
                        <th>房屋信息</th>
                        <td>
                          <p class="display-ib">
                            <span>面积</span>
                            <input class="input-text" type="text" name="post[acreage]" size="8" id="source" value="" placeholder="单位平方米">
                          </p>
                          <p class="display-ib">
                            <span>户型选择</span>
                            <select class="input-text valid" name="post[structure_type]">
                              <option value="">请选择</option>
                              <?php if (isset($selectData[1])) { ?>
                              <foreach name="selectData[1]" item="name" key="value">
                                <option value="{$value}">{$name}</option>
                              </foreach>
                              <?php } ?>
                            </select>
                          </p>
                          <p class="display-ib">
                            <span>装修类型</span>
                            <select class="input-text valid" name="post[decoration_type]">
                              <option value="">请选择</option>
                              <?php if (isset($selectData[2])) { ?>
                              <foreach name="selectData[2]" item="name" key="value">
                                <option value="{$value}">{$name}</option>
                              </foreach>
                              <?php } ?>
                            </select>
                          </p>
                          <p class="display-ib">
                            <span>朝向</span>
                            <select class="input-text valid" name="post[direction]">
                              <option value="">请选择</option>
                              <?php if (isset($selectData[4])) { ?>
                              <foreach name="selectData[4]" item="name" key="value">
                                <option value="{$value}">{$name}</option>
                              </foreach>
                              <?php } ?>
                            </select>
                          </p>
                          <p class="display-ib">
                            <span>用途</span>
                            <select class="input-text valid" name="post[purpose]">
                              <option value="">请选择</option>
                              <?php if (isset($selectData[3])) { ?>
                              <foreach name="selectData[3]" item="name" key="value">
                                <option value="{$value}">{$name}</option>
                              </foreach>
                              <?php } ?>
                            </select>
                          </p>
                        </td>
                    </tr>
                    <tr>
                        <th>位置信息</th>
                        <td>
                          <p class="display-ib">
                            <span>小区名</span>
                            <input class="input-text" type="text" name="post[estate_name]" id="estate_name" value="" placeholder="小区名">
                          </p>
                          <p class="display-ib">
                            <span>地址</span>
                            <input class="input-text" type="text" size="40" name="post[address]" id="estate_name" value="" placeholder="地址">
                          </p>
                          <p class="display-ib">
                            <span>所属区域</span>
                            <select class="input-text valid" name="post[region]">
                              <option value="">请选择</option>
                              <?php if (isset($selectData[7])) { ?>
                              <foreach name="selectData[7]" item="name" key="value">
                                <option value="{$value}">{$name}</option>
                              </foreach>
                              <?php } ?>
                            </select>
                          </p>
                          <p class="display-ib">
                            <span>位置坐标</span>
                            <input class="input-text" type="text" name="post[position]" id="estate_name" value="" placeholder="位置坐标">
                            <a href="https://lbs.qq.com/tool/getpoint/" target="_blank">坐标获取器</a>
                          </p>
                        </td>
                    </tr>
                    <tr>
                        <th>产权信息</th>
                        <td>
                          <p class="display-ib">
                            <span>购买年份</span>
                            <input class="input-text" type="text" name="post[years]" size="6" id="estate_name" value="" placeholder="例：2018">
                          </p>
                          <p class="display-ib">
                            <span>产权</span>
                            <input class="input-text" type="text" name="post[property_year]" id="estate_name" value="" placeholder="单位年，例：70">
                          </p>
                        </td>
                    </tr>
                    <tr>
                        <th>楼层</th>
                        <td>
                          <p class="display-ib">
                            <span>所在楼层</span>
                            <input class="input-text" type="text" name="post[floor]" id="estate_name" value="" placeholder="例：10">
                          </p>
                          <p class="display-ib">
                            <span>总楼层</span>
                            <input class="input-text" type="text" name="post[floorall]" id="estate_name" value="" placeholder="例：20">
                          </p>
                          <p class="display-ib">
                            <span>楼层类型</span>
                            <select class="input-text valid" name="post[floor_type]">
                              <option value="">请选择</option>
                              <?php if (isset($selectData[5])) { ?>
                              <foreach name="selectData[5]" item="name" key="value">
                                <option value="{$value}">{$name}</option>
                              </foreach>
                              <?php } ?>
                            </select>
                          </p>
                        </td>
                    </tr>
                    <tr>
                        <th>交易信息</th>
                        <td>
                          <p class="display-ib">
                            <span>两税</span>
                            <select class="input-text valid" name="post[two_tax]">
                              <option value="">请选择</option>
                              <option value="有">有</option>
                              <option value="无">无</option>
                              <option value="个税">个税</option>
                            </select>
                          </p>
                          <p class="display-ib">
                            <span>税务承担</span>
                            <select class="input-text valid" name="post[tax_bear_type]">
                              <option value="">请选择</option>
                              <?php if (isset($selectData[6])) { ?>
                              <foreach name="selectData[6]" item="name" key="value">
                                <option value="{$value}">{$name}</option>
                              </foreach>
                              <?php } ?>
                            </select>
                          </p>
                          <p class="display-ib">
                            <span>是否欠缴</span>
                            <select class="input-text valid" name="post[arrears]">
                              <option value="-1">请选择</option>
                              <option value="是">欠缴</option>
                              <option value="否">未欠缴</option>
                            </select>
                          </p>
                          <p class="display-ib">
                            <span>户口</span>
                            <select class="input-text valid" name="post[hukou]">
                              <option value="-1">请选择</option>
                              <option value="1">有</option>
                              <option value="0">无</option>
                            </select>
                          </p>
                          <p class="display-ib">
                            <span>最佳带看时间</span>
                            <input class="input-text valid" type="text" name="post[daikanshijian]" value="">
                          </p>
                          <p class="display-ib">
                            <span>倒房时间</span>
                            <input class="input-text valid" type="text" name="post[daofang]" value="">
                          </p>
                          <p class="display-ib">
                            <span>其他说明</span>
                            <input class="input-text valid" type="text" name="post[qitashuoming]" value="">
                          </p>
                        </td>
                    </tr>
                    <tr>
                        <th>佣金</th>
                        <td>
                          <p class="display-ib">
                            <span>成交奖励</span>
                            <input class="input-text" type="text" name="post[reward]" size="50" id="estate_name" value="" placeholder="单位元">
                          </p>
                        </td>
                    </tr>
                    <tr>
                        <th>咨询电话</th>
                        <td>
                          <input class="input-text" type="text" name="post[contact]" id="contact" size="11" value="" placeholder="咨询电话">
                        </td>
                    </tr>
                    <tr>
                        <th>其他信息</th>
                        <td>
                          <p class="display-ib">
                            <span>房源类型</span>
                            <select class="input-text valid" name="post[myself]">
                              <option value="">请选择</option>
                              <?php select_list($selectData['myself']); ?>
                            </select>
                          </p>
                          <p class="display-ib">
                            <span>出售情况</span>
                            <select class="input-text valid" name="post[sell_type]">
                              <option value="">请选择</option>
                              <option value="1">在售</option>
                              <option value="2">即售</option>
                              <option value="3">预售</option>
                              <option value="4">已售</option>
                            </select>
                          </p>
                          <p class="display-ib">
                            <span>是否有密码</span>
                            <select class="input-text valid" name="post[password]">
                              <option value="">请选择</option>
                              <option value="1">是</option>
                              <option value="0">否</option>
                            </select>
                          </p>
                        </td>
                    </tr>
                    <tr>
                        <th>房源优势</th>
                        <td>
                            <script type="text/plain" id="content" name="post[content]"></script>
                        </td>
                    </tr>
                    <tr>
                        <th>带看流程</th>
                        <td>
                          <textarea name="post[process]" rows="8" cols="80"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <th>位置图片</th>
                        <td>
                            <ul id="photos" class="pic-list list-unstyled form-inline"></ul>
                            <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
                               class="btn btn-default btn-sm">选择图片</a>
                        </td>
                    </tr>
                    <tr>
                        <th>视频</th>
                        <td class="form-inline">
                            <input id="file-video" class="form-control" type="text" name="post[video_address]"
                                   value="{$post.more.video|default=''}" placeholder="填写腾讯视频vid" style="width: 200px;">
                            <a href="https://v.qq.com/" target="_blank">腾讯视频</a>
                        </td>
                    </tr>
                </table>
                <hook name="portal_admin_article_edit_view_main"/>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
                        <a class="btn btn-default" href="{:url('AdminArticle/index')}">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <table class="table table-bordered">
                    <tr>
                        <th><b>首图展示</b></th>
                    </tr>
                    <tr>
                        <td>
                            <div style="text-align: center;">
                                <input type="hidden" name="post[thumb]" id="thumbnail" value="">
                                <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                         id="thumbnail-preview"
                                         width="135" style="cursor: pointer"/>
                                </a>
                                <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                            </div>
                        </td>
                    </tr>
                </table>

                <hook name="portal_admin_article_edit_view_right_sidebar"/>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    $(function () {

        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });
</script>
</body>
</html>
